Fixed readme and some minor refactorings