cleaned up ~ functionality