Refactor code to own function
some more tests for Image