Fixed index out of bounds error, and removing functionality