Removed useless code and cosmetic fixes