redesigned into classes