a lot of very ugly code....
build process