functional, but needs improvement in findfactor