Updated the API in order to work with firefox.
Changed some class behaviours to a better comprehension.