Updated analysis, cleaned code through line 229 or so.