Fix bugs in rank and range checking functions
Add basic tests for most of the functions in es module
Add comments for main pa2 program