Moved some things around and updated the code.