Collapsed two methods to avoid excessive variable passing