Performance improvments, extra functions, debugging stats