Init refactor of code to better use prototype