added a bunch of functions for kbase