Refactor changes from #143