Refactored some for version 3