[#9] long code moved to separate method