moved the handleMessage functions to their own file