Bug fixes to target
Fixed indent in main
Added timeout to sync procedure