Seperated handle function from rest of script for easier testing