M104 S0 ; turn off hotend/extruder heater M140 S0 ; turn off bed heater G91 ; set to relative positioning G1 E-2 F300 ; retract the filament a bit before lifting the nozzle to release some of the pressure G1 Z1 ; raise Z 1mm from current position G1 E-2 F300 ; retract filament even more G90 ; set to absolute positioning G1 X20 ; move X axis close to tower but hopefully far enough to keep the fan from rattling G1 Y120 ; move bed forward for easier part removal M84 ; disable motors G4 S360 ; keep fan running for 360 seconds to cool hotend and allow the fan to be turned off - adjust to your needs M107 ; turn off fan. Don't use M106 S1. Using M106 S1 may prevent the fan from turning on for the following print. Some say M107 doesn't work for them but if the hotend is below 70 degrees it should work