Initial refactor effort

Fixed up most of the obvious style issues. More extensive rework is still required in places.
Migrate API communication to Retrofit