updated code with pressure automation