more object-oriented version
change the architecture
Parcial version with canvas