change pulse calculation logic