Revert "Revert "gcc improvments""

This reverts commit 278d2f98a2098e63f99024d4a4a6815886cc0257.
Revert "implement threading"

This reverts commit 26412644618638bd9f879c1a8fecfa2dca99c170.