Added a framework target

* Added a framework target
* Added appledoc documentation
* Minor refactoring and code style fixes