Changed main to no command line, added many functions