added a lot of logic between users and pins