Version 3

Based on mwtaylor's version from the open issue updated to the newest version.