trying to use flex template. probably a big mess right now