I installed refit and upon boot I opened the partition tool and fixed the partition tables. It did its thing and everything worked fine through several reboots. I decided I want to start from scratch so I booted the OS X repair thing to format the drive and reinstall OS X, but it can't format the drive because it's unable to mount, and after failing to format the drive it will no longer boot OS X (it just sits on a white screen after you choose OS X in refit).
What do I do in order to format the drive properly so I can start with a fresh install of OS X?
What do I do in order to format the drive properly so I can start with a fresh install of OS X?