refactored 60% of image processing utilities, added spec tests for them