Refactor of master