changed duration from int to double