Do some JS magic