added helpers and formatted code