Main function moved into separate file.