Removed unnecessary code and fixed a bug in testfile