Move most everything into lib