Made code a bit prettier and fixed a test.
Todo: retest :).