corrected control logics
added time selection functionality