Refactored unless-else to if-else for codestyle and readability