Created cython class in order to simplify the stucture of the code