added js routing and improved validation