works aside from one small bug