Fixes, improved square waves