working dynamic layout. still needs work