Switchable dependency finder

- added option to switch between forward or reverse dependency finder
- cleaned up code