Major rewrite of comms interface (closes #46)