fixed some general bugs - still not functional - infinite looping