One more fix up on the snap and glue functions plus some other general bugs that have been found in testing.