Redeisgned and added some function