Fix major refactor

Refactor is done.