moved queryFreeTimeslots to logic

- refactored it also