Cleanups and better test