fixed some bugs, should be working (rudimentary)