adding pot control code