changed time tick function