Apply comment from @sam to consolidate logic