Added lock to avoid multiple executions
Removed hashtabs and added userid