Finished up the refactoring a little bit.