Moved some code around and renamed some methods for consistency.
Fixed and improved s.indexOf. It now accepts nothing, a query, or an Entity.
Removed a now-unused index property.