Added implementation of second glue query function
Added core functionality to suit added implementation
Slight names refactoring