Move code around

I believe I didn't break anything...