splitted encoder into hpp/cpp