working spiral function, just need to test