modified poly classes and provided all necessary functions