old version
moving out logic into components