added time
organized code