nicely done, looks to be pretty tight with the main loop