removed the mutable variable in favor of a function