filled in skeleton logic