added logging
added more helping functions