Windows support

This is based on @jdiamond's work in #7.