Updated pattern match for readability
With new tests