Added more comments and added more code