Cleaning up

Cleaned up a lot of code. Got rid of warnings, unused references, etc