Rewrite. Added nested layout support. Overhauled testing with jasmine and istanbul.