fixed args in two stage procedure. cleaned up code