Moved some stuff into prepare()