Removed unused code and commented one