added another bwperim method made octave compatible