Refactored the Node app