borrowd monitor.js code and html from thoonk itself
required a lot of little changes