Found error in rectangle fill. It was only going to the bottom of the window. Now it does the whole document. Also I found a problem with the line length variable. The problem has been fixed by repeated redefinition of the variable name