improving step function