added averaging to and time selection to api