moved some code to serverUtil.js, started using promises