Added polygon functionality. Still some compile errors (commented for now).