Some refactoring to deal with Insiel's case study.