moving code into proper location