add guard clause for n = 0