close #50, #53 more refactor