finished two functions;
need to do: change list to ordereddict