Cleanup some ugly code in bokehjs (part 1)