added thread support in order to execute front and rear reading at same time