lumped together stuff from jsbin