server: refactored processing commands in brick controller
server: refactored js in browser client