Some code refactoring and work on build system
More code refactoring and updated readme.