Change history to map instead of list