adding comments and minor refactoring
removed reachability