Refactor to remove inefficient expressions