Enclose code in ccalib namespace. Switch defines to consts.