split into main and funtion file