Applying some refactorings

Few refactorings.

Soon I'll push more of them.