Major code overhaul

Merge this pull request and update your website. There have been a lot of code changes and a lot of much needed code clean up.