Refactored for readability
Only passing required input image