callback now properly functions; moved decl of callback function to open