Above several functions bodies are very same, please consider design you code to reuse as much as possible.