add 407 code for private apps + uniformize indentations