Corrected according to RRyan's recomendations.