Added several functions from various projects