Made things cleaner with better database definitions and added authentication.