Removed warnings, cleaned up some code