overhaul of functions