Add sending of commands to current running editor
Refactor a bit
Add console support