Added a bunch of comments and an indexesOf function