Changed to new API and fixed mouse moved bug