Added files to VS project.
Fixed issues with type casts.