fixed a lot of bugs although still a bit crashy.  Simple implementation working