minor improvements, refactoring
refactoring stuff here and there