Split pelt function to separate file