Dependencies refactored and toggle logic improved.