implemented the alternative, seems the simplest for how the function is used