Updated to new version, code cleanup

Updated to a new version adding some new things. Also cleaned up come of
the code to make it look better.