Made changes to index and sendmessage