add factory for shared functions