Updated unittests. Made several minor improvements.