this is essentially a light version of handler.js