ported, formated, and commented code from ColCon