Refactored auto discovering of paths