Fixed function documentation and cleaned up a bit.