Cleaned up some, and made the code more structured