Added supporting of tan() function. Performed some refactoring.