Added some more functions; changed some lines