Better JS object handling