self to app
added logging and function doc