better way of handling intervals