Improve the ls code