slight refactor to remove code