Added complex selections
Removed a pre-frame log from test
Refactored selection logic into separate module