Revert "Revert "add main function""

This reverts commit 45aab4943b6e04c9eeb8eb52ecf2dd2be5a39148.