removed unnecessary position var, fixed missing call to index 5