Moved common functions to library package