added {{view}} macro and fixed bugs