Add support for customizing target folder

Fixes #570.