Problem 2 solved.

Using very lengthy conditional check.