cleanup code
use named unions for better portability
use macros gor regiter names generation