script for handling mouse