Write integration tests. Correct error in logical comparison in view to use OR instead of AND. Extend a sleep() call in functional tests a bit to give the browser time to catch up.
Move lib.js code into _js.html and delete lib.js and main.js. Less HTTP requests == very good thing.