Cleaned up a bit
Moved some methods to private