small modifications
clean up
Refactorings and several classes added to make it backwards compatible for using apps.
Refactorings and several classes added to make it backwards compatible for using apps.