fixed some bugs, made stuff work, added test case