Added more comments and added to documentation