extra: change alloc to take &mut self, as per XXX comment
extra: change XXX to FIXME and elaborate on comments