moved some code to more appropriate place ( module)