Removed dead code and formatted.