Refactoring (removing bad practices & improving code style)