Refactor and boostrap