Added main function to complete the core