First version, more pretty than efficient.