Added database class for users and devices, moved stuff around for better folder hierarchy, modified public api