finished main function, added base for other functions