Replace method with code