created main function to better organize code