Cleaned up some code and moved some files around.