Refactor + start of gmeans