Logic about suitables is moved to models and add some query optimizations