Restructuring for clarity
Data structures for corners added