Fixed code format

- Fixed whitespace (was so ugly)
- use `loop do` instead of `while 1 do`

Regards.