split waves code into new class