Seperated program into functions.