added animation loop structure, but no animations yet, various refactorings.