rewrote server script in coffee