Rewrote server in javascript