changed functions to static. added some more output messages.