misc code from a previous project