Create agssomcheck.py and clean up.

First commit, cleanup of sensible code.