Code cleanup and moar comments.