Need help coding this op note. Any help is appreciated.

Looking at 27130(total hip replacement); 27047 x 2 (2 ganglion cyst)

There was a large bulbous mass about the size of a golf ball lying posterior and somewhat lateral to the greater tronchanteric . This was found to be encapsulated, it was dissected off of the more superficial tissue. A small window as made in the mass, it was seen to have clear synovial fluid, no evidence of purulence. A culture and sensitivity and Gram stain were sent to lab.
Dissection was carried posterior medially taking down the capsule with the associated mass. The mass was seen to lie in the area of the piriformis and gemelli which were not identifiable. A stalk from the ganglion was seen to run posteriorly interiorly along the femoral neck. The mass was removed, was sent to pathology for evaluation, frozen section. There was seen marked synovial reaction with no evidence of anaplasia of the cells.
A posterior capsulectomy was completed. There was seen marked destruction of the hip joint and the femoral head was more of a sausage shape with articular cartilage. There did not appear to be marked destructive lesions about the femoral head and neck.