Tookout processing into own function