some changes in the read and handle-function