Made a more robust solution to P190
Done P140