refectored some files