Changed the way indexes worked, cleaned up comments