Added crop/extend option for script

Removed a couple of bugs I noticed while changing this