Added Source Destination markers and refactored code