Finished main code.