Modified in acordance to coding guidelines.