many improvements & code size optimalization