completed code and ready to test