major cleanup of functions, additionals