rewrote to not use db