Removed warnings, cleared some errors.

This version seems to be usable in real-world experiments.