restructured, now using objects