working ui and db code