added db functions for window functionality

the limit should be configured by a constant somewhere I think