adjust for github pages
move main.js to main dir for gh-pages to work
some extra clean-up
add error handling
add size driven prevention mechanism