refactored and equivlencies partly fixed