see A1bi/FasT@91c2d9d26c9ea7bcc8ba949efe6bf2b9800b046e
added remember me option, optimizations