Add better bounds checking from Groovy Branch
Merge pull request #130 from DLu/hydro

Add better bounds checking from Groovy Branch