Moved method code into cpp