Encode and decode function for primary keys and related stuff. Improvements in User management.