Cleaned up pasting code