remove unused function
simplify
refactor type spec