reformating and adding some comments
added support for importance filter
reduce LOCs
Added AggregateType to interface
Added implementation of aggregate type
test for aggregate type
Early exit if query is empty
test for aggregate query
Implemented AggregateType
raise error for invalid array type
Added sanity check, raise error for invalid type