Moved code over to cpp (rename)