Updated according to Oleg suggestions on issue #25