Use JSON instead of javascript hacks