edit to finish specifications; add more basic flow and test cases; add exceptions