Refactored Resizing Image. Fixed issue #2