Refactor and cleanup a few things.