Some refactoring so less nesting and add some more info to README