Refactor out common; Complete documentation