Moved possibly reusable functions out of standard program