remove waste duplicated code