Bug Removed and new function implemented