 //view controller
 class ViewController: UIViewController {
     let bag = DisposeBag()
-    let realm = try! Realm()
-    
+
     @IBOutlet weak var tableView: UITableView!
     @IBOutlet weak var tickItemButton: UIBarButtonItem!
     @IBOutlet weak var addTwoItemsButton: UIBarButtonItem!

    override func viewDidLoad() {
        super.viewDidLoad()

        laps = realm.objects(Lap.self).sorted(byKeyPath: "time", ascending: false)

        /*
         Observable<Results<Lap>> - wrap Results as observable
         */
        Observable.from(laps)
            .map {results in "laps: \(results.count)"}
            .subscribe { event in
                self.title = event.element

    }()

    lazy var ticker: TickCounter = {
        let realm = try! Realm()
        let ticker = TickCounter()
        try! realm.write {
            realm.add(ticker)
        }
        return ticker
    }()
