Added comments and removed algorithm function and used code directly.  Ready for tagging