Fixed several problems and improvements.