made code C89 compatible, streamlined sections
fixed formatting (again)