Separates algorithm and implementation for basic items in repo as far as possible
(#328)