Reworked prepare_latest