Added command line flags, locking mechanism and noOverride flag