Cleaned up some code and some warnins