Adapt code to independent library