Add some comments and organize a bit.