CMS-3409 Simplify serverside javascript implementation.