Adding selection support

The multiple commits are caused by me uploading code via Github. I will rebase it all before I merge. 
1. Why do you start at index `1` instead of `0`?
2. It would be better to cache the value of the `length`-property.