master event loop kinda working