Added population count assertion in reserve. Cleaned up wrap_index.