duplicated code removed, code cleanup