Adding debug funtionality