Implemented better query()
Implemented getType()