Created new selector engine

The new selector engine should perform much faster than the previous
one, possibly even faster than other API's.
Updated new selector engine

The new selector engine had a few performance problems so an update was
made to remove some choke points and optimise the flow, at a small cost
to code size.
Clean up of whitespace and unused code
Merge pull request #3 from charsleysa/new-selector

New selector engine