refactoring into layouts
add db connection