make as plugin (fixed #2), fix and refactoring to pass tests, see #1