need to figure out a way to consolidate the helper functions.