moved some stuff into hooks