Fixed whitespace

In Ruby, you have to use two spaces for indenting!
replaced while(1) with loop
Merge pull request #1 from matthiasbeyer/master

Fixed code format