cleaned up pw generator