more documentation and added allocation failure checking