Separation for maintainability

Also additional checks in debugging