clean code to make it work after model changes