Fixed compiler errors and warnings

It does compile, but it is currently unused. I didn't want to remove it as @LinusVanElswijk might need it someday.