add more thorough lis tests
remove unused variable
handle edge cases, add comments