Makefile refactoring
Fixed memory migration
Encoder implementation