Main function

Have a basic draft on the main function.