Shifted some code around