Cosmetic fixes + added tests