refactor & add new function