big fix and revision to version 3