Added method to execute function with scheduler