removed reusable functions from source code, to be stored in a generic library