remeved duplicated code