moved api into seperate module
fix detection for windows