modularize the code. Added fn-partial as externally dependency