Adding selection support

The multiple commits are caused by me uploading code via Github. I will rebase it all before I merge. 
I don't know. I thought that :checked is needed but if it is not, then it can be removed I guess.