changed username and key checking with fxns
small edits
merged karthiks edits with mine