Re-write function to check dependencies