refactoring: code moved out to 'check_dependencies' function