Added Log class plus some bug fixes and improvements