Better database implementation