add internal pull up resistor for input
slight algorith improvment

still no succes in correct ekeep alive handling and buffering