Move building start, end and filter into query object

@pbadenski
@gtrogers