implemented functionality and added more specs to cover object and field conditions fo indexOf