Fixed type errors and added support for Darwin