further improving and code cleanups