Each subroutine should be divided into as many subroutines as is possibly natural. If I can naturally divide up one of your algorithms, it will be considered incorrect!
Each subroutine should check that its inputs are basically correct.
Each subroutine should have a comment describing how to use it. What it returns. And what has to be passed in.