use promises. code cleaning.
restructure