Added selection logic. Buggy as hell.