Changed LOCK_NB into LOCK_SH, removed key words that were not needed, removed commented flock statements