refactoring: moved model into separate "class". made clear API for it