Refactor machine pkg to use interface