Lots of refactoring and library fixes. Got rid of android project errors