Refactor, removing some warnings