commited the code after adding the main method