refactoring, `and' statement works correctly, moved procedures into dedicated module files