Quirky Indenting in Rhino Python Editor

Well, this is a little embarrassing but this piece of code for a tile render script seems to be acting bizarre. The problem seems to be within MoveTarget. The function returns the correct value of center in the first two while loops but in the third while loop, it returns the same value without adding adding distance to it. Why??

def MoveTarget(current,direction,distance):
    if direction == 'Up':
        current.Z= current.Z + distance
    if direction == 'Left':
        current.X= current.X - distance
    if direction == 'Down':
	current.Z= current.Z - distance
    if direction == 'Right':
	current.X= current.X + distance
    return Rhino.Geometry.Point3d(X, Y, Z)

#Move left until the left edge exceeds bb left (X)
while pt[0].X > bb[0].X:
	center= MoveTarget(center, 'Left', horizontal)
	rs.ViewTarget('Front',center)

#Move up until the top edge exceeds bb top (Z)
while pt[2].Z < bb[4].Z:
	center= MoveTarget(center, 'Up', vertical)
	rs.ViewTarget('Front', center)

while pt[2].Z > bb[0].Z:
    #Move right and count until right edge exceeds bb right
    while pt[0].X < bb[1].X:
        center= MoveTarget(center, 'Right', horizontal)
        rs.ViewTarget('Front', center)

Nevermind. I figured it was a problem with indent. Actually, Rhino Python editor has some indent incompatibility issues with other editors (I use Notepad++). While opening a script file (typed in another editor) into Rhino’s editor, I’ve realized it’s pretty good practice to re-indent the entire code.