added final working version of c5