Rearranged code and renamed packages with porting to Objective-C in mind.