added mouse management and proper draw depth priority