Updated to 4.1

The code has been refactored to run in unity 4.1