using promises to compile layouts and fixing detail view to respect layout