update with messy code