First commit: written and tested the two main function.