Handles funtion calls