fix some commenting and complexity issues