Upgraded resolve and added support for basedir