Refactor code. Use core instead of layout