Some small refactor fixes