Main function
Main function