Fixing wrong required dependencies check implementation + some other cleanup.