changed file and dir permissions, removed duplicate removing of dirs