handle empty files and lines
many refactors; get testing working in separate command; finally run full process
fix refactor
fix refactor