Remove redundancies of codes via ch. 5 ecercises