minor cleanup: remove duplicated code