moving some code around