Readability could be improved but the code is correct.