Index: aktoserial/code/Makefile
===================================================================
--- aktoserial/code/Makefile	(revision d851b8b203cf40fb83ab37fb9966d2cff2fdd59a)
+++ aktoserial/code/Makefile	(revision 659bbff06a0d7cc156eb1decf3d25eb45300e698)
@@ -21,2 +21,5 @@
 .c.o:
 	$(COMPILE) -std=c99 -c $< -o $@
+
+flash:
+	avrdude -c usbasp -p atmega8 -Uflash:w:keyboard.hex
Index: aktoserial/code/keyboard.hex
===================================================================
--- aktoserial/code/keyboard.hex	(revision d851b8b203cf40fb83ab37fb9966d2cff2fdd59a)
+++ aktoserial/code/keyboard.hex	(revision 659bbff06a0d7cc156eb1decf3d25eb45300e698)
@@ -1,160 +1,161 @@
-:10000000EFC071C212C107C106C105C104C103C15D
-:1000100002C101C100C1FFC0FEC0FDC0FCC0FBC0E9
-:10002000FAC0F9C0F8C06031323334353637383968
-:10003000302D3D5C3F3071776572747975696F70F2
-:100040005B5D3F3132336173646667686A6B6C3B3A
-:1000500027B93F3435363C7A786376626E6D2C2E44
-:100060002F3F2E3738392008090A0A1B7F3F3F3FB0
-:100070003F3F55444C5231323334353637383930BE
-:100080003F3F3F3F3F4853534358414141413F3F2A
-:100090003F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F70
-:1000A0003F3F3F3F3F3F351E1F202122232425266F
-:1000B000272D2E310062141A0815171C180C121364
-:1000C000302F00595A5B041607090A0B0D0E0F3327
-:1000D0003432005C5D5E641D1B0619051110363755
-:1000E0003800635F60612C4C2B5828292A000000DF
-:1000F000560052514F503A3B3C3D3E3F40414243F7
-:10010000838254555775000039000000000000003C
-:1001100000000000000000000000000000000000DF
-:10012000000000000000022000010400088005011A
-:100130000906A101050719E029E715002501750148
-:1001400095088102950175088103950575010508DB
-:10015000190129059102950175039103950675080A
-:10016000150025650507190029658100C0040309EC
-:10017000042403700075006C006B006F006D00615B
-:10018000006E00640079002E006100740068002E8B
-:100190000063007800160341006D0069006B006584
-:1001A0000079003200750073006200120110010036
-:1001B000000008424231E10001010200010902226F
-:1001C000000101008032090400000103010100095F
-:1001D0002101010001223F000705810308000A00F8
-:1001E00011241FBECFE5D4E0DEBFCDBF10E0A0E6F6
-:1001F000B0E0ECEDF9E002C005900D92A436B10735
-:10020000D9F710E0A4E6B0E001C01D92AB3AB10707
-:10021000E1F70FD1E1C3F4CE8C9A949884E591E094
-:100220000197F1F7949A8C9808951F920F920FB648
-:100230000F9211242F933F938F939F9382B390E457
-:10024000892782BB83992CC080917100882339F45F
-:1002500081E08093710010927300109272003091CF
-:100260007300383090F484990DC02091720080E8BA
-:1002700090E0032E02C0959587950A94E2F7282B0B
-:10028000209372003F5F3093730080917300883039
-:1002900038F0109271001092730081E08093740026
-:1002A0009F918F913F912F910F900FBE0F901F90B4
-:1002B0001895E82FF0E0EA5DFF4F9491809170006F
-:1002C000882311F4892F0895892F80520895839BE4
-:1002D000FECF80EA8A95F1F79FDF1092740080913B
-:1002E00072000895809174008823E1F3F0DF08958F
-:1002F0001092710010927200109273008B98839A82
-:1003000085B7886085BF85B78B7F85BF8BB78068D1
-:100310008BBF789481DF0895FC0187E690E090938D
-:10032000900080938F0080818076803271F581818A
-:10033000813011F488E00895893049F486819781ED
-:10034000019719F581E0809364008FEF0895823062
-:1003500019F486E690E013C08A3029F483818093F3
-:10036000660080E00895833031F48381882369F446
-:100370001092600008958B3041F480E690E09093F5
-:10038000900080938F0081E0089580E00895FC0143
-:1003900080916400882329F0613019F48081809372
-:1003A00065001092640081E00895DF93CF93CDB78C
-:1003B000DEB728970FB6F894DEBF0FBECDBF982FDB
-:1003C0008091800084FFFCCFFE01319688E0DF0140
-:1003D0001D928A95E9F799836B83CF0168E0D9D2A2
-:1003E00028960FB6F894DEBF0FBECDBFCF91DF9138
-:1003F000089598E0E7E6F0E0DF011D929A95E9F7AD
-:10040000282F30E0F901EA55FF4F9491805688304B
-:1004100010F020E004C02A533F4FF90124919923A2
-:1004200011F09093690080916700282B209367005A
-:100430000895DF92EF92FF920F931F938FE028E1D0
-:1004400030E00FB6F894A89521BD0FBE81BD85E0C0
-:1004500083BF8E9A69D14CDF789410E080E4D82E67
-:10046000EE24E39401C0102FA8956BD1F090740096
-:100470008091740081112BDF08B600FE0AC0E8BE2F
-:1004800000916600002329F0153030F0012F05504F
-:1004900001C0012FFF2039F38091800084FFE3CF5A
-:1004A0008CE1A7DF87E690E068E073D282B38D2508
-:1004B00082BBD9CFA82FB92F80E090E041E050EA6D
-:1004C000609530E009C02D9182279795879510F0AF
-:1004D00084279527305EC8F36F5FA8F30895EADF9D
-:1004E0008D939D930895CF93CFB7CF93DF93C3950B
-:1004F000859BE9F7859B0BC0859B09C0859B07C041
-:10050000859B05C0859B03C0859B01C08BC06F93F5
-:10051000C0918E00DD27CB56DF4F2F9365E5859B7D
-:1005200003C02F916F91E6CF0F931F934F9320E05D
-:1005300040E15F9300B3047205FB27F93F9350E05D
-:100540003BE039C0147240642F77012F5F5F1EC0FB
-:10055000406810B314722F7752501FC0406400B32C
-:100560002F770472D1F15F5F00C023C0406210B3E7
-:100570002F77147291F15F5F00C025C004721027BD
-:10058000515012F45D5F0000115027952C3F10B3BD
-:10059000C8F614720127015027952C3FC8F6422750
-:1005A000499300B3047210274F73115027952C3FC5
-:1005B000A8F64695469510B3147279F001270150BC
-:1005C00027952C3F98F66B5A60F3315000B3B0F684
-:1005D00000C010E41ABF002719C03B503195C31B5F
-:1005E000D04010E41ABF0881033C09F10B34F9F044
-:1005F00020918C001981110F1213EDCF4A81441FF5
-:10060000093651F10D3211F0013E29F700939300A4
-:100610003F915F914F911F910F912F916F91CAB7A9
-:10062000C6FD65CFDF91CF91CFBFCF9118952091B7
-:100630009300222369F310919100112391F5343036
-:1006400092F13093910020938D0010918E003BE049
-:10065000311B30938E0027C00091910001300CF5C2
-:100660000AE54F7049F43091610034FD1DC00093DC
-:100670006100C5E7D0E01CC03091800034FD14C09B
-:1006800000938000C1E8D0E013C0052710E000C04F
-:10069000000002BB1AC0052710E0221F1DC010E099
-:1006A00021C04AE502C032ED432FC4E1D0E032E080
-:1006B00011B31462959A02B311BB54E220E865E3CA
-:1006C00020FF052702BB279517951C3FF0F666957E
-:1006D000B8F7B1F720FF052702BB279517951C3FF8
-:1006E000D0F62795179517FF052700001C3F02BB82
-:1006F000B0F629913A9519F70B7D10919200110FE0
-:10070000C651D04002BB11F010938C0010E41ABF08
-:10071000006211B31B7D402F4B7D54E05A95F1F7D9
-:1007200002BB11BB42BB74CF85B7836085BF8BB75B
-:1007300080648BBF8BE4809381008AE58093800086
-:1007400008951F93CF93DF9360919100635067FDED
-:10075000C4C080918E00CCE0D0E0C81BD109CB563C
-:10076000DF4F80918D008D3209F0A4C0683009F010
-:10077000B2C083EC809375008AE58093610010928B
-:100780006F008881807641F0CE010E948C01282F75
-:100790008F3F09F47EC084C09A8110927E008981C7
-:1007A000882321F410927F0022E06CC0853019F478
-:1007B0009093920066C0863009F04FC08B818130E3
-:1007C00041F48BEA91E09093900080938F0022E1B6
-:1007D00040C0823041F48DEB91E090939000809383
-:1007E0008F0022E236C08330F9F48A81882341F4F5
-:1007F0008DE691E09093900080938F0024E029C0D3
-:10080000813041F481E791E09093900080938F00D4
-:1008100024E21FC08230E1F485E991E090939000DA
-:1008200080938F0026E115C0813241F48FEC91E076
-:100830009093900080938F0029E00BC0823241F4A6
-:100840008EE291E09093900080938F002FE301C09F
-:1008500020E080E480936F0023C0883021F421E001
-:1008600084E990E011C0893019F49093940009C094
-:100870008A3011F421E006C08B3019F48BE48093A8
-:10088000810020E08EE790E09093900080938F00AD
-:1008900007C0888187FD2E8180E880936F0006C0A5
-:1008A0008F81882319F48E81821708F0822F80931C
-:1008B000620011C080916F0087FF0DC0CE010E94C1
-:1008C000C7018F3F21F48EE18093610004C088232B
-:1008D00011F010926200109291008091610084FFEB
-:1008E0004AC0809162008F3F09F445C0182F8930BB
-:1008F00008F018E0811B809362008091750098E8F1
-:10090000892780937500112341F120918F00309148
-:10091000900080916F0086FF0DC0A6E7B0E080E0F8
-:1009200090E0F901E80FF91FE491ED930196181793
-:10093000C1F708C0912FD901E6E7F0E08D918193CE
-:100940009150E1F71150812F90E01F5F0196820FC7
-:10095000931F9093900080938F0086E790E0612F23
-:100960000E946F02612F6C5F6C3019F08FEF8093E3
-:1009700062006093610094E180B3847231F491501D
-:10098000D9F71092920010928C00DF91CF911F91B5
-:1009900008951F93DC01162F8091800084FF07C00B
-:1009A0008091810098E889278093810003C08AE5BF
-:1009B00080938000912FE2E8F0E08D918193915037
-:1009C0001916DCF382E890E0612F0E946F021C5F31
-:0C09D000109380001F910895F894FFCF51
-:0409DC00015AFF00BD
+:10000000A7C076C2CAC0BFC0BEC0BDC0BCC0BBC056
+:10001000BAC0B9C0B8C0B7C0B6C0B5C0B4C0B3C02C
+:10002000B2C0B1C0B0C0351E1F2021222324252616
+:10003000272D2E440062141A0815171C180C1213D1
+:100040002F3000595A5B041607090A0B0D0E0F33A7
+:100050003432005C5D5E641D1B06190511103637D5
+:100060003800635F60612C2A2B5828294C0000005F
+:10007000560052514F503A3B3C3D3E3F4041424377
+:100080004A4D54555745000039000000000000005B
+:10009000000000000000022000010440088005016B
+:1000A0000906A101050719E029E7150025017501D9
+:1000B000950881029501750881039505750105086C
+:1000C000190129059102950175039103950675089B
+:1000D000150025650507190029658100C00403097D
+:1000E000042403700075006C006B006F006D0061EC
+:1000F000006E00640079002E006100740068002E1C
+:100100000063007800160341006D0069006B006514
+:1001100000790032007500730062001201100100C6
+:10012000000008424231E1000101020001090222FF
+:1001300000010100803209040000010301010009EF
+:100140002101010001223F000705810308000A0088
+:1001500011241FBECFE5D4E0DEBFCDBF10E0A0E686
+:10016000B0E0E6EEF9E002C005900D92A436B107CA
+:10017000D9F710E0A4E6B0E001C01D92AC3AB10797
+:10018000E1F716D12EC43CCF8C9A949884E591E087
+:100190000197F1F7949A8C9808951F920F920FB6D9
+:1001A0000F9211242F933F938F939F9383992CC089
+:1001B00080917200882339F481E08093720010925C
+:1001C00074001092730030917400383090F4849968
+:1001D0000DC02091730080E890E0032E02C0959539
+:1001E00087950A94E2F7282B209373003F5F3093A2
+:1001F000740080917400883038F010927200109270
+:10020000740081E0809375009F918F913F912F91B1
+:100210000F900FBE0F901F901895839BFECF80EA22
+:100220008A95F1F7B1DF10927500809173000895FF
+:10023000809175008823E1F3F0DF08951092720039
+:1002400010927300109274008B98839A85B788601F
+:1002500085BF85B78B7F85BF8BB780688BBF789450
+:1002600093DF0895282F30E0F901EA5DFF4F4491B4
+:100270008056883010F090E004C02A5C3F4FF901AE
+:100280009491442389F080916100883068F4E82FCC
+:10029000F0E0E859FF4F40838F5F8093610049335E
+:1002A00019F481E08093660080916800982B909308
+:1002B00068000895282F30E0F901EA5DFF4F44916E
+:1002C0008056883010F030E004C02A5C3F4FF901BE
+:1002D00034914423E9F02091610092E015C0E92FA8
+:1002E000F0E0E859FF4F8081841769F407C0E92FD7
+:1002F000F0E0E859FF4F818180839F5F9730B8F32A
+:1003000010926F0021509F5F921748F32093610075
+:100310003095809168003823309368000895FC017F
+:1003200088E690E0909391008093900080818076A1
+:10033000803271F58181813011F488E0089589302F
+:1003400049F486819781019719F581E080936400D3
+:100350008FEF0895823019F487E690E013C08A3059
+:1003600029F483818093670080E00895833031F41D
+:100370008381882369F41092600008958B3041F4E2
+:1003800080E690E0909391008093900081E0089542
+:1003900080E00895FC0180916400882329F0613099
+:1003A00019F48081809365001092640081E00895C3
+:1003B000DF92EF92FF920F931F932FE088E190E07E
+:1003C0000FB6F894A89581BD0FBE21BD85E083BF0F
+:1003D000A59AA49A88E0E8E6F0E0DF011D928A95EC
+:1003E000E9F7A7D12BDF789400E090E1D92E80E2E5
+:1003F000E82EFF24F39401C0012FA895A7D1809186
+:100400007500809175008823C1F007DF95B39D25A5
+:1004100095BB95B39E2595BB982F969580FD03C0FF
+:10042000892F20DF02C0892F45DF8091810084FF62
+:1004300004C088E690E068E0B1D208B600FEDDCFE7
+:10044000F8BE109167001123C1F2053018F0102F8B
+:100450001550D2CF80916600882321F082E62ADFF2
+:10046000109266008091810084FFC6CF88E690E0FC
+:1004700068E094D2C1CFDF93CF93CDB7DEB7289792
+:100480000FB6F894DEBF0FBECDBF982F80918100CC
+:1004900084FFFCCFFE01319688E0DF011D928A9532
+:1004A000E9F799836B83CF0168E078D228960FB67D
+:1004B000F894DEBF0FBECDBFCF91DF910895A82F76
+:1004C000B92F80E090E041E050EA609530E009C04B
+:1004D0002D9182279795879510F084279527305E78
+:1004E000C8F36F5FA8F30895EADF8D939D93089595
+:1004F000CF93CFB7CF93DF93C395859BE9F7859BC8
+:100500000BC0859B09C0859B07C0859B05C0859B4B
+:1005100003C0859B01C08BC06F93C0918F00DD2706
+:10052000CA56DF4F2F9365E5859B03C02F916F91CE
+:10053000E6CF0F931F934F9320E040E15F9300B30A
+:10054000047205FB27F93F9350E03BE039C0147279
+:1005500040642F77012F5F5F1EC0406810B3147294
+:100560002F7752501FC0406400B32F770472D1F12F
+:100570005F5F00C023C0406210B32F77147291F107
+:100580005F5F00C025C004721027515012F45D5FF8
+:100590000000115027952C3F10B3C8F614720127A4
+:1005A000015027952C3FC8F64227499300B30472A7
+:1005B00010274F73115027952C3FA8F64695469566
+:1005C00010B3147279F00127015027952C3F98F64B
+:1005D0006B5A60F3315000B3B0F600C010E41ABF9C
+:1005E000002719C03B503195C31BD04010E41ABFFF
+:1005F0000881033C09F10B34F9F020918D00198139
+:10060000110F1213EDCF4A81441F093651F10D32FB
+:1006100011F0013E29F7009394003F915F914F91B3
+:100620001F910F912F916F91CAB7C6FD65CFDF91D2
+:10063000CF91CFBFCF91189520919400222369F3D9
+:1006400010919200112391F5343092F13093920081
+:1006500020938E0010918F003BE0311B30938F0070
+:1006600027C00091920001300CF50AE54F7049F463
+:100670003091620034FD1DC000936200C6E7D0E0F7
+:100680001CC03091810034FD14C000938100C2E889
+:10069000D0E013C0052710E000C0000002BB1AC064
+:1006A000052710E0221F1DC010E021C04AE502C04E
+:1006B00032ED432FC4E1D0E032E011B31462959AD9
+:1006C00002B311BB54E220E865E320FF052702BB1B
+:1006D000279517951C3FF0F66695B8F7B1F720FF00
+:1006E000052702BB279517951C3FD0F62795179530
+:1006F00017FF052700001C3F02BBB0F629913A9571
+:1007000019F70B7D10919300110FC651D04002BB19
+:1007100011F010938D0010E41ABF006211B31B7D1D
+:10072000402F4B7D54E05A95F1F702BB11BB42BB01
+:1007300074CF85B7836085BF8BB780648BBF8BE434
+:10074000809382008AE58093810008951F93CF9360
+:10075000DF9360919200635067FDC4C080918F0069
+:10076000CCE0D0E0C81BD109CA56DF4F80918E0083
+:100770008D3209F0A4C0683009F0B2C083EC8093D8
+:1007800076008AE5809362001092700088818076FE
+:1007900041F0CE010E948F01282F8F3F09F47EC0C7
+:1007A00084C09A8110927F008981882321F410925D
+:1007B000800022E06CC0853019F49093930066C0ED
+:1007C000863009F04FC08B81813041F48BE191E09C
+:1007D000909391008093900022E140C0823041F4D8
+:1007E0008DE291E0909391008093900022E236C0D8
+:1007F0008330F9F48A81882341F48DED90E0909361
+:1008000091008093900024E029C0813041F481EE72
+:1008100090E0909391008093900024E21FC082307A
+:10082000E1F485E091E0909391008093900026E1BF
+:1008300015C0813241F48FE391E090939100809351
+:10084000900029E00BC0823241F48EE990E0909351
+:100850009100809390002FE301C020E080E480931A
+:10086000700023C0883021F421E085E990E011C0B8
+:10087000893019F49093950009C08A3011F421E071
+:1008800006C08B3019F48BE48093820020E08FE760
+:1008900090E0909391008093900007C0888187FD3D
+:1008A0002E8180E88093700006C08F81882319F420
+:1008B0008E81821708F0822F8093630011C080918F
+:1008C000700087FF0DC0CE010E94CA018F3F21F446
+:1008D0008EE18093620004C0882311F010926300BF
+:1008E000109292008091620084FF4AC08091630060
+:1008F0008F3F09F445C0182F893008F018E0811B9C
+:10090000809363008091760098E889278093760031
+:10091000112341F12091900030919100809170005D
+:1009200086FF0DC0A7E7B0E080E090E0F901E80F96
+:10093000F91FE491ED9301961817C1F708C0912FA4
+:10094000D901E7E7F0E08D9181939150E1F71150E3
+:10095000812F90E01F5F0196820F931F909391006B
+:100960008093900087E790E0612F0E947402612FCE
+:100970006C5F6C3019F08FEF8093630060936200BE
+:1009800094E180B3847231F49150D9F710929300BE
+:1009900010928D00DF91CF911F9108951F93DC017C
+:1009A000162F8091810084FF07C08091820098E813
+:1009B00089278093820003C08AE580938100912F6C
+:1009C000E3E8F0E08D91819391501916DCF383E810
+:1009D00090E0612F0E9474021C5F109381001F91B0
+:0609E0000895F894FFCF1A
+:0409E60001025AFFB1
 :00000001FF
Index: aktoserial/code/main.c
===================================================================
--- aktoserial/code/main.c	(revision d851b8b203cf40fb83ab37fb9966d2cff2fdd59a)
+++ aktoserial/code/main.c	(revision 659bbff06a0d7cc156eb1decf3d25eb45300e698)
@@ -11,14 +11,15 @@
 #include "keycodes.h"
 
-const uint8_t PROGMEM keymatrix[128] = {
-// 0         1                 2            3            4          5          6           7            8            9              A             B             C             D             E              F
-KEY_grave,   KEY_1,            KEY_2,       KEY_3,       KEY_4,     KEY_5,     KEY_6,      KEY_7,       KEY_8,       KEY_9,         KEY_0,        KEY_minus,    KEY_equals,   KEY_backslash, KEY_Reserved,  KEY_KP0,      //0
-KEY_Q,       KEY_W,            KEY_E,       KEY_R,       KEY_T,     KEY_Y,     KEY_U,      KEY_I,       KEY_O,       KEY_P,         KEY_rbracket, KEY_lbracket, KEY_Reserved, KEY_KP1,       KEY_KP2,       KEY_KP3,      //1
-KEY_A,       KEY_S,            KEY_D,       KEY_F,       KEY_G,     KEY_H,     KEY_J,      KEY_K,       KEY_L,       KEY_semicolon, KEY_apostroph,KEY_hash,     KEY_Reserved, KEY_KP4,       KEY_KP5,       KEY_KP6,      //2
-KEY_Euro,    KEY_Z,            KEY_X,       KEY_C,       KEY_V,     KEY_B,     KEY_N,      KEY_M,       KEY_comma,   KEY_dot,       KEY_slash,    KEY_Reserved, KEY_KPcomma,  KEY_KP7,       KEY_KP8,       KEY_KP9,      //3
-KEY_Spacebar,KEY_DeleteForward,KEY_Tab,     KEY_KPenter, KEY_Return,KEY_ESCAPE,KEY_DELETE, KEY_Reserved,KEY_Reserved,KEY_Reserved,  KEY_KPminus,  KEY_Reserved, KEY_UpArrow,  KEY_DownArrow, KEY_RightArrow,KEY_LeftArrow,//4
-KEY_F1,      KEY_F2,           KEY_F3,      KEY_F4,      KEY_F5,    KEY_F6,    KEY_F7,     KEY_F8,      KEY_F9,      KEY_F10,       KEY_KPRParen, KEY_KPLParen, KEY_KPslash,  KEY_KPasterisk,KEY_KPplus,    KEY_Help,     //5
-KEY_Reserved,KEY_Reserved,     KEY_capslock,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,  KEY_Reserved,  KEY_Reserved, //6
-KEY_Reserved,KEY_Reserved,     KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,  KEY_Reserved,  KEY_Reserved, //7
+static uint8_t pressingCaps = 0;
+
+const uint8_t PROGMEM keymatrix[0x70] = {
+// 0         1            2            3            4          5          6           7            8            9              A             B             C             D             E              F
+KEY_grave,   KEY_1,       KEY_2,       KEY_3,       KEY_4,     KEY_5,     KEY_6,      KEY_7,       KEY_8,       KEY_9,         KEY_0,        KEY_minus,    KEY_equals,   KEY_F11,       KEY_Reserved,  KEY_KP0,      //0
+KEY_Q,       KEY_W,       KEY_E,       KEY_R,       KEY_T,     KEY_Y,     KEY_U,      KEY_I,       KEY_O,       KEY_P,         KEY_lbracket, KEY_rbracket, KEY_Reserved, KEY_KP1,       KEY_KP2,       KEY_KP3,      //1
+KEY_A,       KEY_S,       KEY_D,       KEY_F,       KEY_G,     KEY_H,     KEY_J,      KEY_K,       KEY_L,       KEY_semicolon, KEY_apostroph,KEY_hash,     KEY_Reserved, KEY_KP4,       KEY_KP5,       KEY_KP6,      //2
+KEY_Euro,    KEY_Z,       KEY_X,       KEY_C,       KEY_V,     KEY_B,     KEY_N,      KEY_M,       KEY_comma,   KEY_dot,       KEY_slash,    KEY_Reserved, KEY_KPcomma,  KEY_KP7,       KEY_KP8,       KEY_KP9,      //3
+KEY_Spacebar,KEY_DELETE,  KEY_Tab,     KEY_KPenter, KEY_Return,KEY_ESCAPE,KEY_DeleteForward,KEY_Reserved,KEY_Reserved,KEY_Reserved,  KEY_KPminus,  KEY_Reserved, KEY_UpArrow,  KEY_DownArrow, KEY_RightArrow,KEY_LeftArrow,//4
+KEY_F1,      KEY_F2,      KEY_F3,      KEY_F4,      KEY_F5,    KEY_F6,    KEY_F7,     KEY_F8,      KEY_F9,      KEY_F10,       KEY_Home, KEY_End, KEY_KPslash,  KEY_KPasterisk,KEY_KPplus,    KEY_F12,     //5
+KEY_Reserved,KEY_Reserved,KEY_capslock,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,KEY_Reserved,  KEY_Reserved,  KEY_Reserved, //6
 };
 
@@ -30,14 +31,32 @@
 const uint8_t PROGMEM modmatrix[8] = { // contains positions of modifiers in the matrix
   // 0             1               2                 3         4         5         6                  7
-MOD_SHIFT_LEFT,MOD_SHIFT_RIGHT,MOD_NONE,MOD_CONTROL_LEFT,MOD_ALT_LEFT,MOD_NONE, MOD_GUI_LEFT, MOD_GUI_RIGHT,
+MOD_SHIFT_LEFT,MOD_SHIFT_RIGHT,MOD_NONE,MOD_CONTROL_LEFT,MOD_ALT_LEFT,MOD_ALT_RIGHT, MOD_GUI_LEFT, MOD_GUI_RIGHT,
 };
 
 static uint8_t idleRate;
+static uint8_t reportIndex = 2;
 static uint8_t reportBuffer[8]; 
 
 void fillReportBuffer(uint8_t key_code) {
 	uint8_t key, modifier;
-	uint8_t reportIndex = 2; // reportBuffer[0] contains modifiers
-	memset(reportBuffer, 0, sizeof(reportBuffer)); // clear report buffer
+	key = pgm_read_byte(&keymatrix[key_code]);
+	if (key_code >= 0x60 && key_code < 0x68)
+		modifier = pgm_read_byte(&modmatrix[key_code - 0x60]);
+	else
+		modifier = MOD_NONE;
+	if (key != KEY_Reserved && reportIndex < 8) {
+		reportBuffer[reportIndex] = key; // set next available entry
+		reportIndex++;
+		if (key == KEY_capslock)
+			pressingCaps = 1;
+	}
+	reportBuffer[0] |= modifier;
+}
+
+
+void emptyReportBuffer(uint8_t key_code) {
+	
+	uint8_t key, modifier;
+	uint8_t i;
 	key = pgm_read_byte(&keymatrix[key_code]);
 	if (key_code >= 0x60 && key_code < 0x68)
@@ -46,8 +65,14 @@
 		modifier = MOD_NONE;
 	if (key != KEY_Reserved) {
-		reportBuffer[reportIndex] = key; // set next available entry
-		reportIndex++;
+		for (i = 2; i < reportIndex; i++) {
+			if (reportBuffer[i] == key) {
+				for (; i < 7; i++)
+					reportBuffer[i] = reportBuffer[i+1];
+				reportBuffer[7] = 0;
+				reportIndex--;
+			}
+		}
 	}
-	reportBuffer[0] |= modifier;
+	reportBuffer[0] &= ~modifier;
 }
 
@@ -72,8 +97,10 @@
 
 	//debug LED - output
-	DDRD |= (1<<PD6);
+	DDRC |= (1<<PC5);
+	DDRC |= (1<<PC4);
 
 	// Keyboard
-	uint8_t key_code = 0;
+	uint8_t key_code = 255;
+	memset(reportBuffer, 0, sizeof(reportBuffer)); // clear report buffer
 
 	// USB
@@ -90,4 +117,13 @@
 		if (char_waiting) {
 			key_code = ak_read_scancode();
+			PORTC ^= (1<<PC4);
+			PORTC ^= (1<<PC5);
+			// if an update is needed, send the report
+			if ((key_code & 1) == 0)
+				fillReportBuffer(key_code>>1);
+			else
+				emptyReportBuffer(key_code>>1);
+			if (usbInterruptIsReady())
+				usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
 		}
 
@@ -99,17 +135,14 @@
 					idleCounter -= 5; // 22ms in units of 4ms
 				} else { // yes, it is time now
-					updateNeeded = 1;
 					idleCounter = idleRate;
+					if (pressingCaps) {
+						emptyReportBuffer(0x62);
+						pressingCaps = 0;
+					}
+					if (usbInterruptIsReady())
+						usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
 				}
 			}
 
-		}
-		// if an update is needed, send the report
-		if (updateNeeded && usbInterruptIsReady()) {
-			updateNeeded = 0;
-			//fillReportBuffer(key_code);
-			fillReportBuffer(KEY_Y);
-			usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
-			PORTD ^= (1<<PD6);
 		}
 	}
