final code to accept and save notes and their images