refactoring some stuff
refactoring some stuff
merging with master