Fully functional cal program. All tests passing