Adding math class with line algorithm