Implemented backward encoding