Updated code to work for mutliple users dynamically.