Made main function, learning what all the code does