much better
another implementation
clean up cases