Cleanup, bug fix