Cleaned up the SSR code and removed unused variables