Fixes and refactoring in Image class.