cw4/fib: Refactors and optimisations