Fixed invalidation system (event - redraw 1:1 bug) and added test functionality