code refactoring

passed /v1/engine/canonical and /v1/engine/fuzzy api testing