Add comments and minor cleanup