don't expose db and app variables
replaced console logs whit debug()