lastIndexOf with an index

comments and some tweaking

removed tabs

made the comments nicer

improvments derivated from comments