imported original code from Klarna repository