Clean code, and make it working