improved DigitalPort functions (now finished)