added debug logs
fixed some styling and behavior on debug log
moved some listeners to their own functions
switched from callbacks to deferred/promise