factorized push_back and push_front utils