Refactoring code - Added ParseImage function.