first semi-working version with trackball support