Commented, formatted, and removed deprecated code.