added 3BV and cleaned code