refactor expand_to_symbols, add comments, clean code, #9, #23
clean code, #9