Refactored node-app to be more genric