Final submission

Duplicate functions combined -> do_cache_X
Intermediate states re-organized
Verification