move processing into method