code optimized, obsolete functions removed