Moved some things around

and removed some unneeded variables