Clean up code and add createShift function