introducing more asynchrounsity
fixing tests issues and jshint complains