Cleaned up the code and added a missing end tag.