Debug and implenment new function.