implemented begining and end time