removed extra repeated code