moving some code around; debuggin