implemented kernel trick