Rewritted Gfx mechanism, using lambda functions for events