Refactor ls command

PRing this now so that the Russian can work on it some more.