Refactored g5