added db functions for window functionality