added a bunch of helper functions