Added more code, added and fixed some comments