Speed improvements (got rid of a couple divide ops), cleanup...