updated comments and func return erorr