Update to support LED matrix
Refactoring code