Cleanup code structure to follow distinct pattern layouts