Further refactored over to promises pattern