add Main class and a bit of modify