rejig things a little to use meteor template events and move view code o...

...ut of lib