refactor
add layout parsing