Further fixes and cleanup of compiler code
Refactoring and fixes for stdlib