added closest mouse function