port implementation from CAPP project to standalone