Removed unnecessary function and fixed test