Speed up the compilation process v2

Modified version of #113