Fixed error with JSON files being after template in filesystem; cleaned up render function