Adapting from project Damero

Changing some of the logic from project "Damero" by Carlos Luis to
accommodate to the new project.