code cleanup: move drawing to function, to allow "selected" reset on initialize