code cleanup

moved stuff around