modified the constructor and many other changes