more refactor & prune