Refactor: move code into private methods
Change: move this up

 * tried to avoid the second loop
 * didn't understand yet what it did exactly
Merge pull request #2 from till/random

Random