Cleaned up unused bits of code, a little bit of refactoring.