make the base a variable, add documentation