Removed usage of nextSetBit, and instead replaced it with a simpler array iteration.
Added support of creating an entity from a template.
Fixed up component matching.