Cleaned up some bugs