Added routing and made functions with JSON methods