Cleaned up stuff, moved main to bottom of file