Add unit tests for (most) funcs and test on travis