reworked main function to accept data