Make complex IF condition clearer with formatting

Signed-off-by: Martin Koistinen <mkoistinen@gmail.com>
Working tests!

Signed-off-by: Martin Koistinen <mkoistinen@gmail.com>
More thorough testing

Signed-off-by: Martin Koistinen <mkoistinen@gmail.com>