Move messagebox handling to a separate file