Cleaned up some bugs and formatting.