Changed Babenko's HAAR implementation with Grabner's implementation