removing repated code