factor out ls