Made a cargo library out of it and Fixed compiler errors.