Version 1.0.  Code tested successfully with provided test cases