adding base functionality from pfefferle's previous work