Fixed callbacks to fit NodeJS pattern