improved database storing functionality. Still assigning user ID as 0