Improve conditions and readability