Minor changes on handling start and end indices