New window model.

Fixed some errors I made in earlier commits.