Added comments and cleaned up code. Changed output dll name.