moved some stuff to core lib