rearranging the code