Added timeout.
Added rotation validation. copyTermbox() substituded by memcpy().