updated with angularjs directives for flat UI