made function for api calls to remove code duplication;

started preperations for registered users