moved a function further down, added return documentation