A cool refactor

Hi buddy!

- I did a refactor to avoid duplicated code. 
- I fixed some missing global variables, 
- I added gulp to do the minifocation (It's the default task)

Hope this changes are good for you :+1: 

Thanks!