Removed the excess condition, made small code refactoring