Functional code. Next step is to implement nabor lists.