correctly adding to closed list
reworked open list
rough first working draft, no memory checks or freeing