Got the calculate and layer handlers to work as proper API calls now BUT something needs to be done about the encoding