Changed the way some code was organized