Made some minor changes to the code and signatures of methods