Update example, refactor main