Clean up formatting code

Now mostly passes FM912.FOR.