move shared method to lib module