fixed xcode build and did some re-formatting