moving partition to encoder
fixing some mistakes