Refactored and removed duplicates in code block (make clean images)