Improve design, sort out basic mapping function.