splitting encode functions