some more refactoring
removed the unused parameter for the output image