update from original

trying to update my fork with latest changes http://stackoverflow.com/a/23853061/531439