Made some finishing touches, added assertions