Removed unnecessary code & Added Automatic refresh