passing public key as a parameter 

passing public_key as a parameter instead of adding file for each key
setting default value for $uid as undef in case of you don't need to set uid manually