Almost ready to publish

Refactoring and beautifying