Cleaned up bilinear code