main function
works.