Cleanup prefix adding function