Document and remove redundant code, kl last version