Copied basic functions from other projects