Bug fixes; update to latex document