Flag and checking for synced pictures now work. The testing script at
the bottom is a jumbled mess, and will be cleaned up in the final
stages.