written from scratch on JavaScript/jQuery