Allow custom modules to define own validation functions

Refactor custom modules_dir