Refactor to implement with ASCII instead of with arrays
Refactor lines doing the same thing, and rename variables