cleaning up

rearranged code,