     row = editor.getCursorBufferPosition().row
     col = editor.getCursorBufferPosition().column
 
-    # What does this line do?
-    return unless row
-
-    PythonIndent.indentCorrectly(editor, row, col)
-
-
-  indentCorrectly: (editor, row, col) ->
     # Parse the entire file up to the current point, keeping track of brackets
     lines = editor.getTextInBufferRange([[0,0], [row, col]]).split('\n')
 
+    # A stack of [row, col] pairs describing where open brackets are
     bracketStack = PythonIndent.parseLines(lines)
 
-    if not bracketStack.length
-        return
+    return unless bracketStack.length
 
-
-    # this is the column where the bracket was, so need to bump by one
+    # bracketStack.pop()[1] is the column where the bracket was, so need to bump by one
     indentColumn = bracketStack.pop()[1] + 1
 
     # Get tab length for context
     tabLength = editor.getTabLength()
 
-    console.log('indentColumn: ', indentColumn)
-
     # Calculate soft-tabs from spaces (can have remainder)
     tabs = (indentColumn / tabLength)
     rem = ((tabs - Math.floor(tabs)) * tabLength)
-    console.log('tabs: ', tabs, 'rem: ', rem)
 
     # If there's a remainder, `editor.buildIndentString` requires the tab to
     # be set past the desired indentation level, thus the ceiling.
+    # TODO: is the conditional necessary? Maybe to avoid floating point errors?
     tabs = if rem > 0 then Math.ceil tabs else tabs
 
     # Offset is the number of spaces to subtract from the soft-tabs if they


    # I'm glad Atom has an optional `column` param to subtract spaces from
    # soft-tabs, though I don't see it used anywhere in the core.

    console.log('tabs:', tabs, 'offset:', offset)

    indent = editor.buildIndentString(tabs, column=offset)

    console.log('len:', indent.length, 'str: "', indent, '"')

    # Set the indent
    editor.getBuffer().setTextInRange([[row, 0], [row, editor.indentationForBufferRow(row) * tabLength]], indent)


  parseLines: (lines) ->


            # if stringDelimiter is set, then we are in a string
            if stringDelimiter.length
                if isEscaped
                    isEscaped = false
                else
                    if c == stringDelimiter
                        stringDelimiter = []
                    if c == '\\'
                        isEscaped = true
            else
                if c == '#'
                    break
