Add END_SEGMENT flag
Start updating padding implementation