Move common functions to lib.