Clean code to reduce complexity