Adding polygon class and change the structure