Final version - most features are here, only a couple of graphical bugs.