Fixed rendering bug for FF and made huge performance improvements