Improved error handling leveraging fail Errors::XYZ
Fixed actions logic
Code refactoring to avoid some code duplication and naming conventions.