Full implementation of the LIST command