writing methods and tests