wrote the log in code. haven't tested it. probably works