Cleaned up code (formmatting, variable renaming, comments), added grayscale to calculations and images are now resized before being passed to stitchImage