rework model to work with resources; simplify everything.