refactoring
refactred up to equivalencing
Finishing up refactoring.