Implemented success cases, and the rest of the failure cases. Refactored to use case instead of if-then-else