Moved return inside if-else statement.