more work towards nth case code