extracted out vector code into sprg class