Removed duplicate function

duplicated code removed