merging working version