Don't read this. Hastily updated. Simple, but bad code.