added support for arduino-mk and reduced ram usage