Remove unnecessary global usage
Remove redefinitions of variables
Less magick
Don't change current working directory