most of irrelevant code deleted