improvment and debugging everywhere