refactoring of fl.js

Jslinted, scoped in function and replaced Object and Array with literals