re-factored to work with express v4