Tests for fetching N:M with aliases + more refactoring