Formatting, cleanup and added comments.