split decoder into hpp/cpp and implemented missing methods