wrap the main in a function