messy code, but progress meter works