Created a factory for intervals and applied it's use.