Refactor notes#mine to simplify code