first implementation, still not working, but getting there