Refactor fixes