Refactor to use layout