setup mode handlers
add mocha tests