refactored function statements; updated docs & comments