Adds some tests, fixes huge glaring bug