Code cleanup and getting the debitor id in the views