Major overhaul, split file into modules

Separated functions into its correspondent files to have shorter files and use
the module system.

Also, to make the global fjs object I had to add a extend function to objects
with its corresponding test.