Using callbacks instead of promises and code cleanup