modified query() to return entities as keys

returns a list of entities where the key holds the entity rather than
the value. Also improves lookup/insert/remove performance as the type
table no longer needs to be searched.
small optimization to clear function

only updates entity types once per deletion rather than once per
component removal
changed tabs to spaces