add .class
added some changes to the code.