refactoring polygon classes