refactor to reduce line of code