updated to use messages