ironed out extreme cases and reorganized directory