added and changed some functionality