converted some array stuff to lists. Very elegant, much functions.