simplify and clean up
move some functions in drivers and export layout in csv