added numerous improvements