refactor: put common functions in utility module