added notes
index null (and 0) check
don't know if this will be enough..
added error handling