more heavy refactoring
little more cleanup