Added control functions based on time