Added flock, needs testing