made some change, add helper functions