Added debugging function, closed form(sorry)