Implemented main loop with render