Added level saving & loading; separated some code from loops.htm into separate files; did some other cleaning/refactoring