Refactoring into platform and layout backends