a bit of cleanup in js