use handleEvent to process all functions
Merge pull request #3 from gasolin/handleevent

use handleEvent to process all functions