updated for windows compile and library interface