The isStart variable shouldn't be necessary. It's better to split functions up than to add if statements to a function.