improved loggin