Do refcatoring to fib function