Updated functionalities.Better code-3rd version