cleaner logic for getting dependencies