cleanup of unused code and functions for reordering