add use case specs and fix some coding style bugs