Added prepare function.