generator method
extracted renderer and viewport
extracted more concerns from main.js