added return link on sub dirs
optimized code