Lots of refactoring. Removed python build dependency