Created a module to provide the environment. Made some refactorings in handler classes.

Hi,

I created a module to provide the environment for Handler's classes, because there was duplication of code and I proposed the creation of the module. In addition, some refactoring were made in the the Handler's classes, especially in Thin class.

Thanks!