Added handling of "Cursor Depth" option as suggested by Lissanro; various bugfixes