Inlined function and added comments.