Refactored the controller to include the PATH module for more robust path building (using path.join)