cleanup some duplicated functions